package jp.wug.core;

public class ModelException extends Exception {
    private final Object model;
    private final String[] parameters;
    private final String[] alternativeValue;

    ModelException(Throwable cause, Object model, String[] parameters, String[] alternativeValue) {
        super(cause);
        this.model = model;
        this.parameters = parameters;
        this.alternativeValue = alternativeValue;
    }

    public Object getModel() {
        return model;
    }

    public String getParameter() {
        return parameters.length > 0 ? parameters[0] : null;
    }

    public boolean hasAlternativeValue() {
        return alternativeValue.length > 0;
    }

    public String getAlternativeValue() {
        return alternativeValue.length > 0 ? alternativeValue[0] : null;
    }
}